//
//  BaseTableViewController.swift
//  sinaWeibo
//
//  Created by wan on 15/12/14.
//  Copyright © 2015年 wan. All rights reserved.
//

import UIKit


class BaseTableViewController: UITableViewController ,VisitorLoginViewDelegate{
    //新建属性访客视图
    var visitorLoginView:VisitorLoginView?
    
    //设置用户是否登录的标记
    var userLogin = false
    //
    //每次检测到view为 nil 会自动调用  loadview
    override func loadView() {
        if userLogin {
            //显示tableView
            super.loadView()
        }else{
           setVisitorLoginView()
        }
    }
    
   private func  setVisitorLoginView() {
     visitorLoginView = VisitorLoginView()
//    v.backgroundColor = UIColor.redColor()
    
    view = visitorLoginView
    //设置代理
    visitorLoginView?.visitorViewDelegate = self
    self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWillLogin")
    self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
    
    
    }
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    
    func userWillLogin() {
        print("22")
    }
    func userWillRegister() {
        print("44")
    }
  
    
}
